<template>
  <div class="sponsor">
    <div class="blocked">
      <div class="left_btn btn">我发起的申诉</div>
    </div>
    <div>
      <van-field v-model="sstitle" label="申诉主题" placeholder="请输入申诉主题" input-align="right" style="border-bottom:10px solid #f8f8f8;border-top:10px solid #f8f8f8;"/>
      <div class="content">
        <p>申诉原因</p>
        <textarea rows="8" v-model="sstext" class="iptstyle" placeholder="请详细描述申诉原因..."></textarea>
      </div>
      <div class="submit" @click="onSubmitApp">提交申诉</div>
    </div>
  </div>
</template>
<script>
import { initite_appeal } from '../api/api';
export default {
  data(){
    return{
      sstitle:'',
      sstext:'',
      taskid:''
    }
  },
  created(){
    this.taskid = this.$route.params.taskId
  },
  methods:{
    //提交申诉
    onSubmitApp(){
      if(this.sstitle == ''){
        this.$toast('请填写申诉主题！')
      }else if(this.sstext == ''){
        this.$toast('请填写申诉内容！')
      }else{
        let params = {
          task_id:String(this.taskid),
          top:this.sstitle,
          content:this.sstext,
        }
        initite_appeal(params).then(res=>{
          console.log('提交',res)
          if(res.Status == 200){
            this.$toast('提交成功！')
            setTimeout(() => {
              this.$router.push('/complaint')
            }, 1000);
          }else{
            this.$toast(res.Message)
          }
        })
      }
    }
  }
}
</script>
<style lang="stylus" scoped>
.sponsor{
  overflow hidden
  background #fff
  padding 15px 0
  .blocked{
    padding 10px 0 16px 0
		display flex
		justify-content center
		align-items center
	}
  .btn{
    font-size 14px
    line-height 30px
    background #6ba9ff
    padding 0 30px
    color #fff
    box-shadow 0px 1px 6px 0px #b5d4ff
  }
	.left_btn{
    border-radius 30px
	}
  .content{
    padding 10px 16px
    background #fff
    p{
      font-size 14px
      line-height 36px
    }
    .iptstyle{
      border 0
      background #f1f1f1
      border-radius 6px
      padding 10px
      font-size 14px
      width 94%
    }
    textarea::-webkit-input-placeholder{
      color #929292
      font-size 14px
    }
  }
  .submit{
    background #6ba9ff
    margin 10px 16px
    font-size 14px
    color #ffffff
    text-align center
    line-height 40px
    border-radius 20px
  }
}
</style>

